﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Orange.Logistics.Infrastructure;
using Orange.Logistics.Services;
using Orange.Logistics.Models;
using Newtonsoft.Json;

namespace Orange.Logistics.Controllers {
    public class JobController : BaseController<Job> {
        private readonly IJobService service;

        public JobController(IJobService service)
            : base(service) {
            this.service = service;
        }

        protected override Func<Job, object> GetOrderBy(string sort) {
            return j => {
                switch (sort) {
                    case "Name":
                        return j.Name;
                    case "Remark":
                        return j.Remark;
                    case "Status":
                        return j.Status;
                    default:
                        return j.Id;
                }
            };
        }

        protected override void Dispose(bool disposing) {
            if (disposing) {
                service.Dispose();
            }
        }

    }
}
